package cn.cloud.butler.scheduled.repository;

import cn.cloud.butler.scheduled.domain.ProduceSumEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ProduceSumRepository extends JpaRepository<ProduceSumEntity,Long> {

    @Query(value=" select count(*)  from ProduceSum s where s.MacSN =?1 and to_days(UploadTime) = TO_DAYS(NOW())-1", nativeQuery = true)
    int findCountByMacSn(String s);

    @Query(value = "SELECT * FROM `ProduceSum` WHERE MacSN = ?1 and to_days(UploadTime) = to_days(now()) -1",nativeQuery = true)
    List<ProduceSumEntity> findByMacSn(String macSn);
}
